import http from '@/utils/http'
import { TaskPageParams, TaskAddType, taskDetailType, AuditFileAdd, RecordType, getTaskBase } from './projectType'
enum Api {
  taskPageApi = '/task/page',
  taskAddApi = '/task/add',
  taskDeleteApi = '/task/delete',
  taskDetailApi = '/task/detail',
  auditorUploadFileApi = '/auditor/uploadFile',
  recordGetRecordApi = '/record/getRecord',
  getImageUrlApi = '/fileImage',
  recordSaveApi = '/record/save',
  recordRemoveApi = '/record/remove',
  hazardSaveApi = '/hazard/save',
  hazardPageApi = '/hazard/page',
  auditorFilesListApi = '/auditor/filesList',
  getBaselineListApi = '/task/getTaskBaseline',
  hazardDetailApi='/hazard/detail',
  hazardRemoveApi='/hazard/remove',
  hazardUpdateApi = '/hazard/update',
}
export const hazardUpdateApi=async (data)=>{
  return http.put(Api.hazardUpdateApi,data)
}
export const hazardRemoveApi=async (id)=>{
  return http.deleteApi(Api.hazardRemoveApi,id)
}
export const hazardDetailApi=async (data)=>{
  return http.get(Api.hazardDetailApi,data)
}
export const auditorFilesListApi = async (params) => {
  return http.get(Api.auditorFilesListApi, params)
}

export const hazardPageApi = async (data) => {
  return http.get(Api.hazardPageApi, data)
}
export const hazardSaveApi = async (data) => {
  return http.post(Api.hazardSaveApi, data)
}
export const recordRemoveApi = async (data) => {
  return http.deleteData(Api.recordRemoveApi, data)
}

export const recordSaveApi = async (data) => {
  return http.post(Api.recordSaveApi, data)
}
// 图片文件流
// 获取图片文件流
export const getImageUrlApi = async (params) => {
  return http.getImages(`${Api.getImageUrlApi}/${params}`)
}

// 审批记录
export const recordGetRecordApi = async (params: RecordType) => {
  return http.get(Api.recordGetRecordApi, params)
}
export const auditorUploadFileApi = async (params: any) => {
  return http.newPost(Api.auditorUploadFileApi, params)
}
export const taskDetailApi = async (params: taskDetailType) => {
  return http.get(Api.taskDetailApi, params)
}
export const taskDeleteApi = async (id) => {
  return http.deleteApi(Api.taskDeleteApi, id)
}

export const taskAddApi = async (params: TaskAddType) => {
  return http.post(Api.taskAddApi, params)
}
export const taskpageApi = async (params: TaskPageParams) => {
  return http.get(Api.taskPageApi, params)
}
// 获取基线列表getTaskBase
export const getBaselineListApi = async (params) => {
  return http.get(Api.getBaselineListApi, params)
}